﻿using DMSkin.Core.MVVM;
using System;
using System.Windows.Media;

namespace CloudMusic.Model
{
    public class BannerPageItemModel : ViewModelBase
    {
        private int _Page;
        private bool _IsCurrentPage;
        private SolidColorBrush _CurrentPageColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C8C8C8"));
        /// <summary>
        /// 当前页码颜色
        /// </summary>
        public SolidColorBrush CurrentPageColor
        {
            get { return _CurrentPageColor; }
            set
            {
                _CurrentPageColor = value;
                OnPropertyChanged("CurrentPageColor");
            }
        }
        /// <summary>
        /// 是否当前页码
        /// </summary>
        public bool IsCurrentPage
        {
            get { return _IsCurrentPage; }
            set
            {
                _IsCurrentPage = value;
                OnPropertyChanged("IsCurrentPage");
                if (_IsCurrentPage)
                {
                    CurrentPageColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C62F2F"));
                }
                else
                {
                    CurrentPageColor = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C8C8C8"));
                }
            }
        }
        /// <summary>
        /// 页码
        /// </summary>
        public int Page
        {
            get { return _Page; }
            set
            {
                _Page = value;
                OnPropertyChanged("Page");
            }
        }
        /// <summary>
        /// 分页控件Item Model
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="currentPage">当前页码</param>
        public BannerPageItemModel(int page, int currentPage)
        {
            Page = page;
            IsCurrentPage = page == currentPage;
        }
    }
}
